package lesson13;

import javax.swing.*;
import java.util.Collections;
import java.util.List;

public class Test02 extends JFrame {
    private ImageIcon pukeImage = new ImageIcon("images/3_1.jpg");
    private ImageIcon pukeImage1 = new ImageIcon("images/3_2.jpg");
    private DouDiZhu douDiZhu = new DouDiZhu();
    public Test02(){

        this.setLayout(null);

        List<Puke> playerOne = douDiZhu.getPlayerOne();
        for(int i = 0;i < playerOne.size();i++){
            Puke puke = playerOne.get(i);
            JLabel pukeLabel = new JLabel(
                    new ImageIcon("images/"+(puke.getPointValue() + 3)+"_"
                            +(puke.getTypeValue() + 1)+".jpg"));
            pukeLabel.setBounds(100, (playerOne.size() - i - 1) * 30,105,150);
            this.add(pukeLabel);
        }

        List<Puke> playerTwo = douDiZhu.getPlayerTwo();
        for(int i = 0;i < playerTwo.size();i++){
            Puke puke = playerTwo.get(i);
            JLabel pukeLabel = new JLabel(
                    new ImageIcon("images/"+(puke.getPointValue() + 3)+"_"
                            +(puke.getTypeValue() + 1)+".jpg"));
            pukeLabel.setBounds(220 + (playerTwo.size() - i - 1) * 30, 500,105,150);
            this.add(pukeLabel);
        }
//        JLabel pukeLabel = new JLabel(pukeImage);
//        pukeLabel.setBounds(0,0,105,150);
//
//        JLabel pukeLabel1 = new JLabel(pukeImage1);
//        pukeLabel1.setBounds(0,30,105,150);


//        this.add(pukeLabel1);
//        this.add(pukeLabel);



        this.setSize(1000,800);
        this.setDefaultCloseOperation(EXIT_ON_CLOSE);
        this.setLocationRelativeTo(null);
        this.setVisible(true);
    }
    public static void main(String[] args) {
        new Test02();
    }
}
